
package com.example.cia.service;

import com.example.cia.support.HttpService;

public class modifyDeviceService implements Service{
	
	boolean flag;

	@Override
	public void setFlag(boolean b) {
		flag = b;
	}
	
	public modifyDeviceService(){
		flag = false;
	}
	
	public boolean modifyDevice(String deviceId,int deviceState){
		String result;
		HttpService<String> modifyDevice = new HttpService<String>();
		modifyDevice.setUrl("/CIADatabse/modifyDeviceServlet");
		modifyDevice.doHttpGet("id="+deviceId+"&state="+deviceState);
		modifyDevice.setService(this);
		while(true){
			if(!flag);
			else
				break;
		}
		result = modifyDevice.getResult();
		//执行成功后MySQL返回影响行数，为1表示成功，为0表示失败
		if(result.matches("true"))
			return true;
		return false;
	}

}
